var table;
var $;
layui.use(['layer','form','table'],function(){
    table=layui.table;
    $=layui.$;

    showtables();

});
//展示审核详情
function showtables(){
    var id=$("input[name='productId']").val();
    console.log(id);
    $.post("/OpeHome/getOperation",{"productId":id,"type":3}, function (data) {
        tables(data.obj);
        console.log(data.obj);
    });
};
//审核详情表格
function tables(data){
    table.render({
        elem:"#table_id",//容器
        data:data,
        title:"商品操作日志",
        limit:10,//分页显示条数
        toolbar:false,
        page:true,
        cols:[[//定义列
            //{type:'checkbox',align:'center',width:50},//复选框靠左
            {title:'序号',align:'center',width:60,templet:function(data){
                    return data.LAY_INDEX;
                }},
            {field:"product_code",title:"商品编号",align:'center',width:100},
            {field:"product_name",title:"商品名称",align:'center',width:188},
            {title:"销售价格",align:'center',width:130,templet:function(data){
                    return "<p style=''>"+data.currentprice_product+"</p>"+
                        "<p style=''>"+data.originalprice_product+"</p>";
                }},
            {field:"state",title:"上/下架",align:'center',width:120,templet:function(data){
                    if(data.product_sate==1){
                        return "上架";
                    }else{
                        return "下架";
                    }
                }},
            {field:"product_sate",title:"审核状态",align:'center',width:140,templet:function(data){
                    if(data.product_sate==3){
                        return "审核通过";
                    }
                }},
            {field:"",title:"操作信息",align:'center',width:264,height:100,templet:function(d){
                    var date=d.update_date;
                    date = date.slice(0, date.indexOf("."));
                    date = date.replaceAll('T',' ');

                    return "<div style=''>"+d.true_name+"</div>"+
                        "<div style=''>"+date+"</div>";
                }},

        ]]
    });
}